<template>
  <div class="mod-prod-info">
    <el-table :data="value" border>
      <el-table-column type="index" width="50" label="序号" align="center" show-overflow-tooltip></el-table-column>

      <el-table-column prop="mcjskz" label="面材＋胶水克重" align="center"></el-table-column>
      <el-table-column prop="mcjshd" label="面材＋胶水厚度" align="center"></el-table-column>
      <el-table-column prop="dzhd" label="底纸厚度" align="center"></el-table-column>
      <el-table-column prop="dzkz" label="底纸克重" align="center"></el-table-column>
      <el-table-column prop="cz" label="初粘" align="center"></el-table-column>
      <el-table-column prop="bll" label="剥离力" align="center"></el-table-column>
      <el-table-column prop="pdjg" label="判定结果" align="center"></el-table-column>
      <el-table-column prop="biz" label="备注" align="center"></el-table-column>

      <el-table-column label="操作" width="50" header-align="right">
        <template slot-scope="scope">
          <div style="display: flex;justify-content: space-between;">
            <el-link icon="el-icon-delete" size="mini" @click="handleDelete(scope.$index, scope.row)"
                     type="danger" :underline="false"></el-link>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        // 数据库中的规格
        dbSpecs: [],
        // 根据选定的规格所查询出来的规格值
        dbSpecValues: [],
        specs: [], // 使用的规格
        initing: false
      }
    },
    components: {
    },
    props: {
      value: {
        default: [],
        type: Array
      },
      prodName: {
        default: ''
      },
      pid: {
        default: ''
      }
    },
    watch: {
    },
    // activated: function () {
    //   this.$emit('input', [Object.assign({}, this.defalutSku)])
    // },
    created: function () {
    },
    computed: {
    },
    methods: {
      handleAdd(data) {
        this.value.push(data)
      },
      handleDelete(index, row) {
        this.$confirm(`确定要删除吗?`, '友情提醒', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
            .then(() => {
              this.value.splice(index, 1)
            })
            .catch(() => { })
      },
      tableRowClassName({ row, rowIndex }) {
        if ((rowIndex+1)%2 === 1) {
          return 'warning-row'
        } else {
          return 'success-row'
        }
        return ''
      }
    }
  }
</script>
<style>
.el-table .warning-row {
  background: oldlace;
}

.el-table .success-row {
  background: #f0f9eb;
}
</style>
